package com.ddd.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * 处理整个web controller 的异常
 */
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler( {ArithmeticException.class , NullPointerException.class})
    public String errorArithException(Exception e)
    {
        e.printStackTrace();
        return "login";
    }
}
